import * as TYPES from "../action-types";

const baseAction = {
  // 异步方法
  async infoAsync() {
    let info = null;
    try {
      let res = await Api.getUserInfoApi();
      if (res.code === 200) {
        info = res.data;
      }
    } catch (error) {
      console.log(error);
    }
    return {
      type: TYPES.BASE_INFO,
      info,
    };
  },
  // 同步方法
  clearInfo() {
    return {
      type: TYPES.BASE_INFO,
      info: null,
    };
  },
};

export default baseAction;
